package test;

import java.util.Scanner;

public class TriangularIf {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.print("请输入第一条边的长度：");
        double edg1 = scanner.nextDouble();
        System.out.print("请输入第二条边的长度：");
        double edg2 = scanner.nextDouble();
        System.out.print("请输入第三条边的长度：");
        double edg3 = scanner.nextDouble();
        ifTriangular(edg1,edg2,edg3);
    }
    private static void ifTriangular(double edg1, double edg2, double edg3) {
        if ((edg1 + edg2 > edg3 && edg1 + edg3 > edg2 && edg2 + edg3 > edg1)) {
            double n1 = edg1 - edg2 > 0 ? edg1 - edg2 : edg2 - edg1;
            double n2 = edg1 - edg3 > 0 ? edg1 - edg3 : edg3 - edg1;
            double n3 = edg2 - edg3 > 0 ? edg2 - edg3 : edg3 - edg2;
            if (n1 < edg3 && n2 < edg2 && n3 < edg1){
                System.out.println("能构成三角形");
            }else {
                System.out.println("不能构成三角形");
            }
        }else {
            System.out.println("不能构成三角形");
        }
    }
}
